Variant Discovery ◾ 117
fasterq-dump --progress --outdir fastq id
The “--progress” option is to display the downloading progress, “--outdir fastq” specifies
the directory where FASTQ files are downloaded, and “id” is replaced by any of the above
SRA run IDs.
The above “fasterq-dump” form is suitable for a single run, but what if we have multiple
run IDs as above, or in some cases, we may have tens of IDs to download and running that
command for each ID would be tedious. In such case, bash “while loop” would come in
handy. First, we need to store the above run IDs in the file “ids.txt”, each run ID in a line,
and save the file in the current directory and then run the following bash script, which cre-
ates the subdirectory “fastq” and then uses “while loop” to loop over each run ID in the text
file and use it as an argument for the “fasterq-dump” command as follows:
mkdir fastq
while read id;
do
fasterq-dump --progress --outdir fastq “$id”
done < ids.txt
The above script creates the directory “fastq” and downloads the FASTQ files into it. There
are two FASTQ files for each sample since the reads are paired end (forward and reverse
FIGURE 4.3 Using fasterq-dump to download FASTQ files from the NCBI SRA database.